Skip to main content

All Questions

3votes
1answer
463views

Parse and format var_dump data to become more readable

I have a class that exposes var_dump data in order to get better human readable layout. I have achieved this with a lot of ...
Minos Framework's user avatar
0votes
2answers
139views

User interface HTML string generated using PHP

Goal This is very basic beginner script, only for prototyping, probably never to reach alpha/beta prototyping/production, is being designed/tested for performance. Its performance quality might be ...
Emma's user avatar
  • 3,592
2votes
2answers
128views

Writing a ~100Kb HTML string over an MD file (number of iterations ~10K)

I have tried to write a large string (~100-120 Kb of HTML) on an md file, and am pretty sure it's not the fastest method, even though it only has to iterate ~8000-...
Emma's user avatar
  • 3,592
2votes
1answer
261views

Equity data processing: Fast and/or efficient file writing using PHP

Problem This project gets the past ~20 days of an equity data (such as $AAPL, $AMZN, $GOOG) plus the current equity "quote" (which comes every 60 seconds using a free API) and estimates seven "real-...
Emma's user avatar
  • 3,592
0votes
1answer
131views

Read JSON files, basic calculations and write over another JSON file

Class SectorController calculates weight coefficients for sector performances in equity exchange markets using minute data from an API (for instance, if a group of ...
Emma's user avatar
  • 3,592
0votes
2answers
155views

Sanitizing name strings using PHP

Functionality: This method removes a list of specific terms (e.g., LLC, INC, Inc, Company, etc.) from a list of public companies names. It is part of a class that can be viewed in this link. I'd ...
Emma's user avatar
  • 3,592
0votes
1answer
467views

Probability suite for an array of elements

I wrote a function that can be used to generate a probability distribution for an array of elements (probGen()), and another that can be used to select an element ...
Tobi Alafin's user avatar
2votes
2answers
171views

Shuffle array elements by rearranging the key value associations

PHP's shuffle() function destroys the array keys, so I decided to write a shuffle function that doesn't do that and instead rearranges key-value associations. As I ...
Tobi Alafin's user avatar
3votes
1answer
1kviews

PHP + PDO - Inserting data on the table with a loop

First of all i made a simple code to insert data on my table, with the information from this code i made a loop to insert data on another table for a notification system. I'm new to PHP and i think ...
mario's user avatar
1vote
1answer
87views

Decrease execution time in updating rows in PHP

Any tips on how the below code can be optimised for faster execution? I have a table in postgres called staging with the below columns; ...
pippa dupree's user avatar
7votes
3answers
3kviews

Trimming unicode whitespace, control characters, and line breaks with regex

I'm getting user submitted text from a <textarea></textarea>, and I want to edit it a bit before storing it in a database. Here are my 3 regexes, with ...
comesuccingfuccslot's user avatar
1vote
1answer
1kviews

PHP subset of 2 arrays containing objects - compared only by 1 attribute

I'm looking for a fast way to get the subset of 2 arrays containing the same kind of objects using PHP functions. I'm looking for the red part: ...
Maui's user avatar
3votes
1answer
151views

Calculating the difference between 2 arrays

I made this function to calculate the difference between 2 arrays and return it in a third array. I'm using this function as a part of stocktaking functionality I apply in my accounting system. ...
Accountant م's user avatar
2votes
2answers
99views

Returning the number of records per day

I'm writing a query to get the number of sessions created each day for the past 90 days. I'm currently using a prepared statement to do this - looks something like this: ...
fireinspace's user avatar
2votes
2answers
3kviews

Dynamic PHP Form Submit Script

Below is a PHP script which dynamically finds and process all of the form elements such as inputs, textareas, dropdowns etc... then organize them into a table as shown in the image below when sending ...
Leo's user avatar
  • 789

153050per page
close